/**
 * @param {number} x
 * @return {boolean}
 */
var isPalindrome = function(x) {
    if(x<0)return false;
    if(x<10)return true;

    let y = 1, r = 0;
    while(y<x){
        let t = (x/y)|0;

        //console.log(x,y,r,t);

        y *= 10;
        r = r*10 + t%10;
    }
    return x===r;
};


console.log(isPalindrome(-2147447412));